/*
 * Copyright (c) 2021, Beijing Yonyou Audit Software. All rights reserved.
 *
 */
package proxy.staticProxy;

/**
 * @author Clannad
 * @Date 2021-11-22
 */
public class ActionProxy implements ActionInterface {
    /**
     * 需要代理的对象
     */
    private ActionInterface actionInterface = null;

    /**
     * 默认代理对象为自己
     */
    public ActionProxy() {
        this.actionInterface = new ActionProxy();
    }

    public ActionProxy(Object... objects) {

    }

    public ActionProxy(ActionInterface realAction) {
        this.actionInterface = realAction;
    }

    /**
     * 动作
     */
    @Override
    public void action() {
        this.before();
        this.actionInterface.action();
        this.after();
    }

    private void before() {
        System.out.println("出发前");
    }

    private void after() {
        System.out.println("出发后");
    }
}
